package com.hytc.mymall.frgament;

import android.view.View;
import android.widget.AdapterView;

import com.hytc.mymall.base.BaseFragment;


/**
 * Created by allkiss on 2016/12/9
 */

public class SalesmanFragment extends BaseFragment implements AdapterView.OnItemClickListener
{
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    }

    @Override
    public void initView(View p0) {

    }
//    private SalesmanAdapter adapter;
//    private List<AreaBean.Province> areaList;
//    private List<SalesmanBean.Rows_Salesman> list;
//    private LinearLayout ll_nodata;
//    private ListView lv;
//    private int page;
//    private PullToRefreshListView ptrlv;
//    private TextView tv_Ttotal;
//
//    public SalesmanFragment() {
//        this.page = 1;
//        this.list = new ArrayList<SalesmanBean.Rows_Salesman>();
//    }
//
//    static /* synthetic */ void access$1(final SalesmanFragment salesmanFragment, final int page) {
//        salesmanFragment.page = page;
//    }
//
//    private void initData() {
//        this.loadData(true, true);
//        this.loadAreaData();
//        this.adapter = new SalesmanAdapter((Context)this.getActivity(), this.list, this.areaList);
//        this.lv.setAdapter((ListAdapter)this.adapter);
//    }
//
//    private void loadAreaData() {
//        this.areaList = new ArrayList<AreaBean.Province>();
//        final AreaBean areaBean = BaseTools.getBean((Context)this.getActivity(), "area.txt", AreaBean.class);
//        if (areaBean != null) {
//            this.areaList = areaBean.data;
//        }
//    }
//
//    private void loadData(final boolean b, final boolean b2) {
//        final HashMap<String, String> hashMap = new HashMap<String, String>();
//        hashMap.put("token", ActivityManager.loginBean.auth.aukeyValue);
//        hashMap.put("page", new StringBuilder(String.valueOf(this.page)).toString());
//        hashMap.put("rows", "10");
//        hashMap.put("version", "2.0.4");
//        http.OkHttpClientManager.postAsyn("http://www.51ydgy.com/appagent/mySalesmansPageList", new http.StringPopCallBack(this.getActivity(), b) {
//            @Override
//            public void onResponse(final String s) {
//                SalesmanBean salesmanBean;
//                while (true) {
//                    while (true) {
//                        try {
//                            salesmanBean = GsonUtils.json2Bean(s, SalesmanBean.class);
//                            if (salesmanBean == null || !salesmanBean.code.equals("0")) {
//                                break;
//                            }
//                            if (b2) {
//                                if (salesmanBean.data.total == 0) {
//                                    SalesmanFragment.this.ll_nodata.setVisibility(0);
//                                }
//                                else {
//                                    SalesmanFragment.this.ll_nodata.setVisibility(8);
//                                }
//                                SalesmanFragment.this.tv_Ttotal.setText((CharSequence)(String.valueOf(SalesmanFragment.this.getResources().getString(2131362002)) + salesmanBean.data.total));
//                                SalesmanFragment.this.list.clear();
//                                SalesmanFragment.this.list.addAll(salesmanBean.data.rows);
//                                SalesmanFragment.this.ptrlv.onPullDownRefreshComplete();
//                                if (salesmanBean.data.total < 10 * SalesmanFragment.this.page) {
//                                    SalesmanFragment.this.ptrlv.setHasMoreData(false);
//                                    SalesmanFragment.this.ptrlv.setPullLoadEnabled(false);
//                                }
//                                SalesmanFragment.this.adapter.notifyDataSetChanged();
//                                return;
//                            }
//                        }
//                        catch (Exception ex) {
//                            SalesmanFragment.this.ll_nodata.setVisibility(0);
//                            ex.printStackTrace();
//                            return;
//                        }
//                        SalesmanFragment.this.list.addAll(salesmanBean.data.rows);
//                        SalesmanFragment.this.ptrlv.onPullUpRefreshComplete();
//                        continue;
//                    }
//                }
//                ToastUtils.showToastWithImage((Context)SalesmanFragment.this.getActivity(), salesmanBean.msg, false);
//            }
//        }, hashMap);
//    }
//
//    private void setPullLoad() {
//        this.ptrlv.setPullLoadEnabled(true);
//        this.ptrlv.setPullRefreshEnabled(true);
//        this.ptrlv.setOnRefreshListener((PullToRefreshBase.OnRefreshListener<ListView>)new PullToRefreshBase.OnRefreshListener<ListView>() {
//            @Override
//            public void onPullDownToRefresh(final PullToRefreshBase<ListView> pullToRefreshBase) {
//                SalesmanFragment.this.ptrlv.setPullLoadEnabled(true);
//                SalesmanFragment.access$1(SalesmanFragment.this, 1);
//                SalesmanFragment.this.loadData(false, true);
//            }
//
//            @Override
//            public void onPullUpToRefresh(final PullToRefreshBase<ListView> pullToRefreshBase) {
//                final SalesmanFragment this$0 = SalesmanFragment.this;
//                SalesmanFragment.access$1(this$0, 1 + this$0.page);
//                SalesmanFragment.this.loadData(false, false);
//            }
//        });
//    }
//
//    @Override
//    public void initView(final View view) {
//        final RelativeLayout relativeLayout = this.$(view, 2131100413);
//        final TextView textView = this.$(view, 2131100411);
//        this.tv_Ttotal = this.$(view, 2131099893);
//        this.ll_nodata = this.$(view, 2131099755);
//        this.ptrlv = this.$(view, 2131099894);
//        (this.lv = this.ptrlv.getRefreshableView()).setDividerHeight(1);
//        relativeLayout.setVisibility(8);
//        textView.setText((CharSequence)this.getResources().getString(2131362000));
//        this.lv.setOnItemClickListener((AdapterView$OnItemClickListener)this);
//    }
//
//    public View onCreateView(final LayoutInflater layoutInflater, final ViewGroup viewGroup, final Bundle bundle) {
//        return layoutInflater.inflate(2130903128, (ViewGroup)null);
//    }
//
//    public void onItemClick(final AdapterView<?> adapterView, final View view, final int n, final long n2) {
//        final Intent intent = new Intent((Context)this.getActivity(), (Class)SalesmanMerchantActivity.class);
//        intent.putExtra("name", this.list.get(n).realname);
//        intent.putExtra("usernumber", this.list.get(n).usernumber);
//        this.startActivity(intent);
//    }
//
//    @Override
//    public void onViewCreated(final View view, final Bundle bundle) {
//        super.onViewCreated(view, bundle);
//        this.setPullLoad();
//        this.initData();
//    }
}
